function getBaseUrl()
{
	var l = window.location;
	var base_url = l.protocol + "//" + l.host + "/" + l.pathname.split('/')[1];
	return base_url;
}
$(document).ready(function(){
     
	$("#changepasswordform").submit(function(event) {
	    /* Stop form from submitting normally */
	     event.preventDefault();
	    /* Get some values from elements on the page: */
	     var ajaxUrl = getBaseUrl()+'/index.php/settings/changepassword';
	     var values = $(this).serialize();
	        $.ajax({
	        url: ajaxUrl,
	        type: "post",
	        data: values,
	        success: function(data){
	        	var url = getBaseUrl()+'/index.php/signin/logout';    
	        	$(location).attr('href',url);
	        },
	        error:function(){
	            
	            alert('There is error while submit');
	            //$("#result").html('There is error while submit');
	        }
	    });
	  });
});